/**
 * @author brianxia
 * @version 1.0
 * @date 2022-11-11 10:17
 */
public class Student {
    private String name;
    private Integer id;
    private String address;
    private Integer age;

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", id=" + id +
                ", address='" + address + '\'' +
                '}';
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    private Student(String name, Integer id, String address,Integer age) {
        this.name = name;
        this.id = id;
        this.address = address;
        this.age = age;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public static Builder builder(){
        return new Builder();
    }

    //创建静态内部类
    public static class Builder{

        private String name;
        private Integer id;
        private String address;
        private Integer age;

        public Builder name(String name){
            this.name = name;
            return this;
        }

        public Builder id(Integer id){
            this.id = id;
            return this;
        }

        public Builder address(String address){
            this.address = address;
            return this;
        }

        public Builder age(Integer age){
            this.age = age;
            return this;
        }

        public Student build(){
            return new Student(this.name,id,address,age);
        }
    }
}
